package com.zl.smartmall.library.po;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;

/**
 * 商品详情页图文详情
 * 
 * @author 陈希然
 * 
 */
public class ProductDetailGraphicDetailInfo {

	private int width;
	private int height;
	private String url;
	private String intro;
	private String title;

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getIntro() {
		return intro;
	}

	public void setIntro(String intro) {
		this.intro = intro;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}
	
	public static List<ProductDetailGraphicDetailInfo> parse(JSONArray jsonArray) throws JSONException {
		List<ProductDetailGraphicDetailInfo> productDetailGraphicDetailInfos = new ArrayList<ProductDetailGraphicDetailInfo>();
		for(int i = 0; jsonArray != null && i < jsonArray.length(); i++) {
			ProductDetailGraphicDetailInfo productDetailGraphicDetailInfo = new ProductDetailGraphicDetailInfo();
			productDetailGraphicDetailInfo.setHeight(jsonArray.getJSONObject(i).getInt("height"));
			productDetailGraphicDetailInfo.setWidth(jsonArray.getJSONObject(i).getInt("width"));
			productDetailGraphicDetailInfo.setUrl(jsonArray.getJSONObject(i).getString("pic"));
			productDetailGraphicDetailInfo.setIntro(jsonArray.getJSONObject(i).getString("text"));
			productDetailGraphicDetailInfo.setTitle(jsonArray.getJSONObject(i).getString("title"));
			productDetailGraphicDetailInfos.add(productDetailGraphicDetailInfo);
		}
		return productDetailGraphicDetailInfos;
	}
}
